package com.wat.ext;

import com.wat.domain.Order;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;

public class OrderFactoryBean implements FactoryBean<Order>,  InitializingBean, DisposableBean {

	private Order order;

	@Override
	public Order getObject() throws Exception {
		return order;
	}

	@Override
	public Class<?> getObjectType() {
		return OrderFactoryBean.class;
	}

	@Override
	public boolean isSingleton() {
		return false;
	}

	@Override
	public void afterPropertiesSet() throws Exception {
		order = new Order("wat", "OrderFactoryBean1");
	}

	@Override
	public void destroy() throws Exception {
		order = null;
	}
}
